<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1, maximum-scale=1, user-scalable=no"
    />
    <title>Vite + Vue + TS</title>
  </head>
  <!-- 因为 iOS Safari 默认不会触发 :active 伪类，解决方法是在 body 标签上添加一个空的 ontouchstart 属性。具体说明详见：https://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari/33681490#33681490 -->
  <body ontouchstart="">
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>

    <script>
      // 禁止ios10+页面缩放: https://blog.csdn.net/qq_46003166/article/details/106851406
      const disabledScale = () => {
        var lastTouchEnd = 0
        document.addEventListener('touchstart', function (event) {
          if (event.touches.length > 1) {
            event.preventDefault()
          }
        })
        document.addEventListener(
          'touchend',
          function (event) {
            var now = new Date().getTime()
            if (now - lastTouchEnd <= 300) {
              event.preventDefault()
            }
            lastTouchEnd = now
          },
          false
        )

        // 阻止双指放大
        document.addEventListener('gesturestart', function (event) {
          event.preventDefault()
        })
      }

      disabledScale()
    </script>
  </body>
</html>
